package day9;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int m = in.nextInt();
            System.out.println(med(n, m));
        }
    }
    public static int med(int n, int m) {
        // m == 1 || n == 1
        if((n == 1 && m >= 1) || (m == 1 && n >= 1)) {
            return m + n;
        }
        // n > 1, m > 1
        return med(n - 1, m) + med(n, m - 1);
    }
}